package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ImageView imageView = findViewById(R.id.iv);



        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 通过加载xml动画设置文件来创建一个 Animation 对象
       //         Animation animation = AnimationUtils.loadAnimation(MainActivity.this,
        //               R.anim.alpha);  //alpha透明度

                Animation animation = AnimationUtils.loadAnimation(MainActivity.this,
                        R.anim.rotate);  //旋转

//                Animation animation = AnimationUtils.loadAnimation(MainActivity.this,
          //              R.anim.scale);  //scale缩放

             //   Animation animation = AnimationUtils.loadAnimation(MainActivity.this,
              //          R.anim.translate); //translate移动

                imageView.startAnimation(animation);
            }
        });




    }
}